package com.sso.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.sso.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class PrizeController {

    @Reference
    private UserService userService;


    @RequestMapping("/prize")
    public String prize(String jwt) {
        if (StringUtils.isEmpty(jwt)) {
            return "redirect:http://localhost:8083/login";
        }
        // 根据携带的jwt参数去调用userService服务验证串是否正确
        boolean isLogin = userService.validateJwt(jwt);
        if (!isLogin) {
            return "redirect:http://localhost:8083/login";
        }
        return "prize";
    }

}
